From: Colin Walters Date: Fri, 11 Sep 2009 16:47:53 +0000 (-0400) Subject: Don't proxy methods through overview; add a getWorkspacesForWindow() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~10923 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=33f9895d7101bc5dc97d9bc4eafd3ee944a738a3;p=gnome-shell.git Don't proxy methods through overview; add a getWorkspacesForWindow() Duplicating the methods was unnecessary. Also, we want a getWorkspacesForWindow() method as preparation for multi-monitor work. https://bugzilla.gnome.org/show_bug.cgi?id=594699 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 9caf83475..9c20e5cbd 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -848,8 +848,8 @@ RunningWellItem.prototype = { if (this._menu == null) { this._menu = new WellMenu(this); - this._menu.connect('highlight-window', Lang.bind(this, function (menu, window) { - Main.overview.setHighlightWindow(window); + this._menu.connect('highlight-window', Lang.bind(this, function (menu, metaWindow) { + Main.overview.getWorkspacesForWindow(metaWindow).setHighlightWindow(metaWindow); })); this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) { let id; @@ -858,7 +858,8 @@ RunningWellItem.prototype = { id = this.appInfo.get_id(); else id = null; - Main.overview.setApplicationWindowSelection(id); + + Main.overview.getWorkspacesForWindow(null).setApplicationWindowSelection(id); })); } diff --git a/js/ui/overview.js b/js/ui/overview.js index 326a86aed..c8d272993 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -386,6 +386,18 @@ Overview.prototype = { this.show(); }, + /** + * getWorkspacesForWindow: + * @metaWindow: A #MetaWindow + * + * Returns the Workspaces object associated with the given window. + * This method is not be accessible if the overview is not open + * and will return %null. + */ + getWorkspacesForWindow: function(metaWindow) { + return this._workspaces; + }, + /** * activateWindow: * @metaWindow: A #MetaWindow @@ -401,31 +413,6 @@ Overview.prototype = { this.hide(); }, - /** - * setHighlightWindow: - * @metaWindow: A #MetaWindow - * - * Draw the user's attention to the given window @metaWindow. - */ - setHighlightWindow: function (metaWindow) { - if (this._workspaces) - this._workspaces.setHighlightWindow(metaWindow); - }, - - - /** - * setApplicationWindowSelection: - * @appid: Application identifier string - * - * Enter a mode which shows only the windows owned by the - * given application, and allow highlighting of a specific - * window with setHighlightWindow(). - */ - setApplicationWindowSelection: function (appid) { - if (this._workspaces) - this._workspaces.setApplicationWindowSelection(appid); - }, - //// Private methods //// _showDone: function() { diff --git a/js/ui/workspaces.js b/js/ui/workspaces.js index 3fcb6019e..d36366bfb 100644 --- a/js/ui/workspaces.js +++ b/js/ui/workspaces.js @@ -544,6 +544,13 @@ Workspace.prototype = { return -1; }, + /** + * lookupCloneForMetaWindow: + * @metaWindow: A #MetaWindow + * + * Given a #MetaWindow instance, find the WindowClone object + * which represents it in the workspaces display. + */ lookupCloneForMetaWindow: function (metaWindow) { let index = this._lookupIndex (metaWindow); return index < 0 ? null : this._windows[index]; @@ -573,6 +580,12 @@ Workspace.prototype = { } }, + /** + * setHighlightWindow: + * @metaWindow: A #MetaWindow + * + * Draw the user's attention to the given window @metaWindow. + */ setHighlightWindow: function (metaWindow) { for (let i = 0; i < this._windows.length; i++) { this._windows[i].actor.lower(this._lightbox); @@ -1157,7 +1170,14 @@ Workspaces.prototype = { } }, - // See comments in overview.js + /** + * setApplicationWindowSelection: + * @appid: Application identifier string + * + * Enter a mode which shows only the windows owned by the + * given application, and allow highlighting of a specific + * window with setHighlightWindow(). + */ setApplicationWindowSelection: function (appId) { let appSys = Shell.AppMonitor.get_default();